package com.example.demo.Interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;
import java.util.List;

@Configuration
public class LoginConfig implements WebMvcConfigurer{
    @Autowired
    private LoginInterceptor interceptor;
    private List<String> paths= Arrays.asList("/user/login","/book_add.html","/book_list.html",
            "/book_update.html","/css/**"
            ,"/js/**","/pic/**","/login.html","/**.ico");

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns(paths);
    }
}



